/**
 * 
 */

function trovaStraniera(id) {
	var txtbox = document.getElementById(id).value;
	var word = new String(txtbox.toLowerCase());
	var counter=0;
	
	area.value = "";
	
	for (var i = 0; i < word.length; i++) {
		switch (word.charAt(i)) {
		case 'x':
			counter++;
			break;
		case 'y':
			counter++;
			break;
		case 'j':
			counter++;
			break;
		case 'k':
			counter++;
			break;
		case 'w':
			counter++;
			break;
		default:
			break;
		}
	}
	
	if(counter>0){
		if (counter==1) {
			area.value += "La parola "+word+" ha "+counter+" carattere straniero\n";
		}else {
			area.value += "La parola "+word+" ha "+counter+" caratteri stranieri\n"; 
		}
	}else {
		area.value += "La parola "+word+" NON ha caratteri stranieri\n";
	}
	
}